<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>Ericsson_mhealth_mn_graphical_viewer_framework_web_service_test</title>
<script type="text/javascript" language="javascript"
	src="ericsson_mhealth_mn_graphical_viewer_framework_web_service/ericsson_mhealth_mn_graphical_viewer_framework_web_service.nocache.js"></script>
<script src="http://code.jquery.com/jquery-latest.js"></script>
<link rel="stylesheet"
	href="http://github.com/jquery/qunit/raw/master/qunit/qunit.css"
	type="text/css" media="screen" />
<script type="text/javascript"
	src="http://github.com/jquery/qunit/raw/master/qunit/qunit.js"></script>

<script>
		$(document).ready(function(){
			module("MeasurementData REST service");
			var setup = function(fn) {
				setup.response = "";
				jQuery.ajax({
					url: "measurementData?dataAmount=100",
					dataType: "json",
					success: function(html) {
						setup.response = html;
					}
				});
			};
			setup();
			
			asyncTest("some response is returned", function() {
				expect(1);
				setTimeout(function(){
					ok(setup.response && setup.response != "", "Some response is returned and it does not contain an empty string.");
					start();
				},5000);
			});

			test("Response contains an array", function() {
				ok(setup.response.length, "response contains lenght property");
			});

			test("Each array element contains x and y property", function() {
				ok(setup.response[0].x && setup.response[0].y, "timeStamp and value propery exist.");
			});
			
			test("Test that response contains UTC time", function() {
				ok(value = new Date(setup.response[0].timeStamp), "Date exists. Value: " + value);
			});
		});
  </script>

</head>

<body>
<iframe src="javascript:''" id="__gwt_historyFrame" tabIndex='-1'
	style="position: absolute; width: 0; height: 0; border: 0"></iframe>
<h1 id="qunit-header">Ericsson Mobile Health - Client Side Unit
Tests</h1>
<h2 id="qunit-banner"></h2>
<h2 id="qunit-userAgent"></h2>
<ol id="qunit-tests"></ol>
</body>
</html>